broadway: Enable TCP_NODELAY for output socket
authorAlexander Larsson <alexl@redhat.com>
Tue, 15 Mar 2011 10:47:38 +0000 (11:47 +0100)
committerAlexander Larsson <alexl@redhat.com>
Tue, 15 Mar 2011 10:47:38 +0000 (11:47 +0100)
This makes us send data immediately, giving a much snappier
over-network experience.

gdk/broadway/broadway.c

index d5e944d382fbf7e5da9aeb3a79a22fae4d649e6a..714905f9cf6f056f907dd30269bee553312eb5f7 100644 (file)
@@ -4,6 +4,10 @@
 #include <assert.h>
 #include <errno.h>
 #include <zlib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
 
 #include "broadway.h"
 
@@ -540,12 +544,15 @@ BroadwayOutput *
 broadway_output_new(int fd, guint32 serial)
 {
   BroadwayOutput *output;
+  int flag = 1;
 
   output = g_new0 (BroadwayOutput, 1);
 
   output->fd = fd;
   output->serial = serial;
 
+  setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int));
+
   broadway_output_write_header (output);
 
   output->zfd = gzdopen(fd, "wb");